Fix dde_tests: import OptimizationOptimJL for BFGS, use AutoForwardDiff#310
Conversation
…dDiff
The DDE test referenced `BFGS` and `Optimization` without importing the
packages that provide them. Under the old `include`-everything `runtests.jl`,
`optim_test.jl`'s `using Optim`/`OptimizationOptimJL` leaked `BFGS` into the
shared `Main` scope, so the missing import went unnoticed. With the
SciMLTesting v1.2 migration each test file now runs in its own isolated
module, exposing `UndefVarError: BFGS not defined`.
Add `using Optimization, OptimizationOptimJL` (both already test deps) and
drop the dead, unused `Opt(:GN_ESCH, 1)` line.
Fixing the import revealed a second, latent failure: `AutoZygote()` gradient
preparation for the DDE loss errors with `MethodError: no method matching
_prepare_pullback_aux` in DifferentiationInterface. The sibling `nlopt_test.jl`
already documents this ("#zygote behaves weirdly here") and uses
`AutoForwardDiff()`; switching the DDE test to `AutoForwardDiff()` makes it run
and assert the real result (res.u[1] ≈ 0.5).
Verified locally on Julia 1.10 with the CI-pinned stack (Optimization 4.8.0,
OptimizationBase 2.14.0, OptimizationOptimJL 0.4.5, DifferentiationInterface
0.7.18) running the file in an isolated @safetestset: 1 Pass, 0 errors.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
After the SciMLTesting v1.2 migration (SciML#308) each test file runs in its own isolated @safetestset module, so latent missing imports that were previously masked by the old include-everything runtests.jl now surface as UndefVarError. `test/likelihood.jl` and `test/test_on_monte.jl` both use the qualified `Optimization.OptimizationProblem`/`Optimization.AutoForwardDiff` but only imported a re-exporting backend (OptimizationBBO / OptimizationOptimJL). `using OptimizationOptimJL` re-exports Optimization's *exported symbols* but does not bind the `Optimization` *module* name into scope, so the qualified references errored with `UndefVarError: Optimization not defined`. This is the same class of failure SciML#310 already fixed in dde_tests.jl. Add `Optimization` (already a test dep via [extras]/[targets]) to the `using` line of both files. No assertions changed. Verified locally on Julia 1.10 (the compat floor / CI lts) by running each file in an isolated @safetestset against the develop'd package: Core/likelihood.jl isolated | 5 Pass, 0 errors Core/test_on_monte.jl isolated | 1 Pass, 0 errors Both Runic-format clean (format_string is a no-op). Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Documentation job was red on master after the OrdinaryDiffEq v7 /
DifferentialEquations v8 ecosystem bump. Three independent docs-source
breakages, all fixed against the current API:
- verbose: OrdinaryDiffEq v7 rejects a `Bool` for `verbose`
(`ArgumentError: Passing a Bool for verbose is no longer supported ...
Use DEVerbosity() or a preset like Standard(), None(), etc. from
SciMLLogging`). Replace `verbose = false` with `verbose = None()`
(a SciMLLogging AbstractVerbosityPreset, the no-output preset) and add
`using SciMLLogging: None`. Affects getting_started.md,
generalized_likelihood.md, stochastic_evaluations.md.
- StochasticDiffEq solvers: DifferentialEquations v8 was slimmed to
{OrdinaryDiffEq, Reexport, SciMLBase} and no longer re-exports the SDE
solvers, so `SRIW1`/`SOSRI` in stochastic_evaluations.md errored with
UndefVarError. Add an explicit `using StochasticDiffEq: SRIW1, SOSRI`
(matching how the package's own tests import them).
- EnsembleSolution indexing: `sim[i]` now returns a scalar (flat
element indexing), not the i-th trajectory, so the ensemble.md loss
`losses[i](sim[i])` hit `MethodError: no method matching
(::L2Loss)(::Float64)`. Use `sim.u[i]` to get the i-th ODESolution.
Add SciMLLogging and StochasticDiffEq to docs/Project.toml [deps]+[compat].
No test/example was skipped, broken, warnonly-ed, or loosened.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
After the SciMLTesting v1.2 migration (SciML#308) each test file runs in its own isolated @safetestset module, so latent missing imports that were previously masked by the old include-everything runtests.jl now surface as UndefVarError. `test/out_of_place_odes.jl` used `L2Loss`, `build_loss_objective`, and `two_stage_objective` (all exported by DiffEqParamEstim) but only imported `OrdinaryDiffEq, Test, SciMLSensitivity, Optimization, OptimizationOptimJL`. Under the old shared-`Main` runtests, a sibling file's `using DiffEqParamEstim` leaked those names into scope; under v1.2 isolation the file aborts the Core run with `UndefVarError: L2Loss not defined`. This was the last file failing all three Core variants (lts/1/pre) and the Downgrade job. Same class of failure already fixed in this PR for dde_tests.jl, likelihood.jl, and test_on_monte.jl. Add `DiffEqParamEstim` to the `using` line. No assertions changed; the `Optimization.AutoZygote()` loss path works here unchanged. Verified locally on Julia 1.10 (CI lts / compat floor) by running the file in an isolated @safetestset against the develop'd package: OOP isolated | 2 Pass, 0 errors (was: UndefVarError: L2Loss not defined) Runic-format clean (format_string is a no-op). Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Update: fix
|
Problem
Master CI is red on all three
tests / Corevariants (Julia lts/1/pre) and theDowngradejob. All fail identically:Root cause
test/dde_tests.jlusedBFGSandOptimizationwithout importing the packages that provide them. It only didusing DiffEqParamEstim, OptimizationNLopt.Before the SciMLTesting v1.2 migration (#308), the old
runtests.jlincluded every test file into the sameMainmodule.optim_test.jl'susing Optim/OptimizationOptimJLtherefore leakedBFGSinto shared scope, so the missing import indde_tests.jlwent unnoticed. After #308, each file runs in its own isolated@safetestsetmodule, so the latent missing import surfaces asUndefVarError.Fix
using DiffEqParamEstim, Optimization, OptimizationOptimJL(both already test deps via[extras]/[targets]) soBFGS/Optimizationresolve.opt = Opt(:GN_ESCH, 1)line (it referencedOptfrom the now-removedOptimizationNLoptimport and was never used — the solve usesBFGS()).AutoZygote()toAutoForwardDiff(). Fixing the import revealed a second latent failure:AutoZygote()gradient preparation for this DDE loss errors withMethodError: no method matching _prepare_pullback_auxin DifferentiationInterface 0.7.18. The siblingnlopt_test.jlalready documents this exact issue (#zygote behaves weirdly here) and usesAutoForwardDiff(). With ForwardDiff the test actually runs and asserts the real result.No test was skipped, broken, or loosened — the
@test res.u[1] ≈ 0.5 atol = 5.0e-3assertion is unchanged and genuinely passes.Local verification
Ran
test/dde_tests.jlinside an isolated@safetestseton Julia 1.10 with the exact CI-pinned stack (Optimization 4.8.0, OptimizationBase 2.14.0, OptimizationOptimJL 0.4.5, DifferentiationInterface 0.7.18, Zygote 0.7.10):runic --check test/dde_tests.jlpasses (exit 0, no diff).(The separate
Documentationjob failure is unrelated — external linkcheck 403/timeout ondocs.sciml.ai/Zygote/stable/andsensitivity.sciml.ai/dev/— and is not addressed here.)Please ignore until reviewed by @ChrisRackauckas.
Update (additional fixes)
After fixing
dde_tests.jl, the Core/Downgrade jobs surfaced the same latent missing-import bug in two more files, now also fixed in this PR:test/likelihood.jlandtest/test_on_monte.jlboth call the qualifiedOptimization.OptimizationProblem/Optimization.AutoForwardDiffbut only imported a re-exporting backend (OptimizationBBO/OptimizationOptimJL).using OptimizationOptimJLre-exports Optimization's exported symbols but does not bind theOptimizationmodule name into scope, so under v1.2 isolation these errored withUndefVarError: Optimization not defined(likelihood.jl:26was the first file to abort the Core run;test_on_monte.jlsorts after it and would have failed next). AddedOptimization(already a test dep via[extras]/[targets]) to theusingline of both.Local verification (Julia 1.10, the compat floor / CI lts), each file in an isolated
@safetestset:Both files are Runic-format clean. No assertions were skipped, broken, or loosened.
Update: the
Documentationjob is now also fixed hereThe
Documentation / Build and Deployred was a pre-existing master failure from the OrdinaryDiffEq v7 / DifferentialEquations v8 ecosystem bump. It is now addressed in this PR (commitdocs: migrate examples to current solver/EnsembleSolution API). There were three independent docs-source breakages, all fixed against the current API — no example was skipped,warnonly-ed, or loosened:verbose = false→verbose = None(). OrdinaryDiffEq v7 rejects aBoolforverbose(ArgumentError: Passing a Bool for verbose is no longer supported ... Use DEVerbosity() or a preset like Standard(), None(), etc. from SciMLLogging).None()is the no-outputSciMLLogging.AbstractVerbosityPreset(the closest match for the oldfalse). Addedusing SciMLLogging: None. Affectsgetting_started.md,generalized_likelihood.md,stochastic_evaluations.md.{OrdinaryDiffEq, Reexport, SciMLBase}and no longer re-exportsSRIW1/SOSRI, sostochastic_evaluations.mdhitUndefVarError. Addedusing StochasticDiffEq: SRIW1, SOSRI(same way the package's own tests import them).EnsembleSolutionindexing changed.sim[i]now returns a scalar (flat element index), not the i-th trajectory, soensemble.md'slosses[i](sim[i])errored withMethodError: no method matching (::L2Loss)(::Float64). Changed tosim.u[i](the i-thODESolution).Added
SciMLLoggingandStochasticDiffEqtodocs/Project.toml[deps]/[compat](both already in the resolved Manifest as transitive deps; resolution unchanged, DifferentialEquations stays at v8.0.0).Local verification (Julia 1.12, the failing CI
1channel): reproduced the originalverbose=falseArgumentError, then ran every affected@exampleblock end-to-end after the fix —getting_startedrecoversa≈1.5(1-param) and[1.5,1.0,3.0,1.0](multi-param);ensembleloss is exactly0.0on the generating sim and bothFminbox(BFGS())/BFGS()recover[1.5,1.0]; the SDE page'sSRIW1/SOSRIsolves andNone()resolve.